package FIT::eg::Fixture::KeyValue;

use FIT::Class;
use FIT::Document::Transformer;

extends 'FIT::Fixture::KeyValue';

# KeyValue fixtures need an attribute for each possible key
has foo => (is => 'rw', isa => 'Bool');
has bar => (is => 'rw', isa => 'Int');
has baz => (is => 'rw', isa => 'Str');

# KeyValue fixture need to implement one function: apply
# will be called after table has been read into foo, bar, and baz
# here we just paste foo bar and baz to the end of the table
sub apply {
    my $table = shift;
    local $_;
    my $out = join ', ', map { "$_=". $self->$_ } qw(foo bar baz);
    transform { AddFooterCell content is $out } $table;
}
